<?php

$toolbar    =new ToolBarHelper($act);
$toolbar->setSubmitAjax(true);
if($act=="add")
{
    $title = '[New Category]';
    $toolbar->SetTitle($title);
    $toolbar->Back(getUrlBack());
    $toolbar->Save('Save',2);
    $toolbar->Save('Save & Exit');
}
else if($act=="edit")
{
    $title = '[Edit Category]';
    $toolbar->SetTitle($title);
    $toolbar->Back(getUrlBack());
    $toolbar->Apply();
    $toolbar->Save();
}
else if($act=="filter")
{
    $toolbar->SetTitle("[filter]");
    $toolbar->Back(getUrlBack());
    $toolbar->addNew('addfilter','add Filter','idP='.$idP);
}
else if($act=="addfilter")
{
    $toolbar->SetTitle('[add filter]');
    $toolbar->Back("?module=$module&opt=filter&idP=".$idP);
    $toolbar->Save('Save',2);
    $toolbar->Save('Save & Exit');
}
else if($act=="editfilter")
{
    $toolbar->SetTitle('[edit filter]');
    $toolbar->Back("?module=$module&opt=filter&idP=".$idP);
    $toolbar->Apply();
    $toolbar->Save('Save & Exit');
}
else if($act=="property")
{
    $toolbar->SetTitle("[property]");
    $toolbar->Back(getUrlBack());
    $toolbar->Apply();
    $toolbar->Save('Save & Exit');
}
else
{
    $toolbar->setSubmitAjax(false);
    if(count($categories)>0)
    {
        $toolbar->Delete();
    }else
    {
        $toolbar->Delete('delete','Delete Category','id='.$id);
    }
    if(count($categories)>0)
    {
        $toolbar->Apply();
    }

    if($id>0)
    {
        $toolbar->Edit('filter','Edit filter','idP='.$id);
        $toolbar->Edit('property','Edit Property','id='.$id);
        $toolbar->Edit('edit','Edit Category','id='.$id);
    }
    
    $toolbar->addNew('add','New Category','id='.$id);
}
?>